import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
//一级路由
import Dashboard from '@/views/dashbord'
import Login from '@/views/login'
import Confirm from '@/views/confirm'
import Search from '@/views/home/search'
import product from '@/views/product'
//二级路由
import Home from '@/views/home'
import Cate from '@/views/cate'
import Cart from '@/views/cart'
import Mine from '@/views/mine'
import Address from '@/views/confirm/address'
import Shopxq from '@/views/confirm/shopxiangqing'
//三级路由
import Edit from '@/views/confirm/address/edit'
import Newdizhi from '@/views/confirm/address/newdizhi'
const routes = [
 {path:'/',redirect:'/dashbord'},
 {
	 path:'/dashbord',
	 component:Dashboard,
	 name:'dashbord',
	 children:[
		 {path:'/',redirect:'home'},
		 {
			 path:'home',
			 component:Home,
			 name:'home',
			 meta:{title:'首页',active:0,isKeep:true}
		 },
		 {
			 path:'cate',
			 component:Cate,
			 name:'cate',
			 meta:{title:'分类',active:1,isKeep:true}
		 },
		 {
			 path:'cart',
			 component:Cart,
			 name:'cart',
			 meta:{title:'购物车',active:2,isKeep:false}
		 },
		 {
			 path:'mine',
			 component:Mine,
			 name:'mine',
			 meta:{title:'个人中心',active:3,isKeep:true}
		 }
	 ]
 },
 {
	 path:'/login',
	 component:Login,
	 name:'login',
	 meta:{
			title:'登录',
			isKeeps:false,
		 }
 },
 {
	 path:'/search',
	 component:Search,
	 name:'search',
	 meta:{title:'搜索',isKeeps:true}
 },
 {
	 path:'/confirm',
	 component:Confirm,
	 name:'confirm',
	 meta:{
		 title:'确认订单',
		 isKeeps:false
	 },
	 children:[
		 {
			path:'shopxiangqing',
			component:Shopxq,
			name:'shopxiangqing',
			meta:{title:'商品列表'}
		 },
		 {
			path:'address',
			component:Address,
			name:'address',
			children:[
				{
					path:'edit',
					component:Edit,
					name:'edit',
					meta:{title:'修改地址'}
				},
				{
					path:'newdizhi',
					component:Newdizhi,
					name:'newdizhi',
					meta:{title:'新增地址'}
				},
			],
			meta:{title:'地址列表'} 
		 }
	 ]
 },
 {
	 path:'product',
	 component:product,
	 name:'product',
	 meta:{title:'产品详情'}
 }
]

const router = new VueRouter({
  routes
})

export default router
